package com.example.first_app;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@SpringBootApplication
public class task {

    @RestController
    public class TaskController{

        @RequestMapping("/random")
        public String random(){
            Random random = new Random();
            int randomNumber = random.nextInt(1000);
            return  "Random number is : "+ randomNumber;
        }

        @RequestMapping("/square/{n}")
        public String square(@PathVariable int n){
            int square = n * n;
            return "the square of "+ n + "is： "+ square;
        }
    }



}
